Conversation
|
I clean up the code and comments. Will do one more round in a day or so. |
| * R = U * sqrt(D); find singular value decomposition of R such that | ||
| * R = Y * S * V'; calculate Q such that B = Q * R = Q * Y * S * V' | ||
| * = X * S * V' where X = Q * Y. | ||
| * @note if isGram is false, it will lose half or more of the precision |
|
Please check current outputs for the unit test from partialSVDandTallSkinnySVDSuite.scala. UnitTestsResults.txt |
| * Computes the partial singular value decomposition of the[[BlockMatrix]] | ||
| * A given an [[BlockMatrix]] Q such that A' is close to A' * Q * Q'. | ||
| * The columns of Q are orthonormal. | ||
| * A given an [[BlockMatrix]] Q such that A' ~= A' * Q * Q'. The columns |
There was a problem hiding this comment.
Please don't use "=". In many languages, that means "not equal to". You can just omit the "=" and use only "".
| /** | ||
| * Compute the singular value decomposition of the [[RowMatrix]] A such that | ||
| * A = U * S * V' via computing the Gram matrix of A. We (1) compute the | ||
| * A ~= U * S * V' via computing the Gram matrix of A. We (1) compute the |
There was a problem hiding this comment.
Please don't use "=". In many languages, that means "not equal to". You can just omit the "=" and use only "".
| // perform orthonormalization twice so the columns of left singular | ||
| // vectors of A will be orthonormal to 15 digits. | ||
| val ifTwice = if (i == iteration - 1) true else false | ||
| y = c.orthonormal(sc, isGram, ifTwice) |
| * Compute the singular value decomposition of the [[RowMatrix]] A such that | ||
| * A = U * S * V' via computing the Gram matrix of A. We (1) compute the | ||
| * Gram matrix G = A' * A, (2) apply the eigenvalue decomposition on | ||
| * G = V * D * V',(3) compute W = A * V, then the Euclidean norms of the |
| // Apply orthonormal to A such that A = Q * R. | ||
| orthonormal | ||
| // Apply computeSVDbyGram to A and directly return the result. | ||
| return computeSVDbyGram |
There was a problem hiding this comment.
What happens if computeU = false?
|
Please check current outputs for the unit test from partialSVDandTallSkinnySVDSuite.scala. |
| * columns of the matrix be orthonormal to nearly the machine | ||
| * precision. | ||
| * @param ifTwice whether to compute orthonormalization twice to make | ||
| * the columns of the matrix be orthonormal to nearly the |
There was a problem hiding this comment.
There seems to be an extra space before the first "the".
… unit test; update partialSVD so that ifTwice = false during the subspace iterations, while ifTwice = true during lastStep; change some inline comments.
…ons of isGram and ifTwice.
(1) move tallSkinnySVD and computeSVDbyGram to IndexedRowMatrix from RowMatrix. (2) tallSkinnyQR and computeSVD exist in both RowMatrix and IndexedRowMatrix. (3) add the corresponding unit tests in test suite file of IndexedRowMatrix. (4) delete our own unit test. (5) add 3 examples of tallSkinnySVD, computeSVDbyGram, partialSVD to example folder. Multiply USV back and see the difference is hard because we cannot use toBreeze in this case. The alternative is converting them to BlockMatrix and using spectralNormEst, but I think this will make the examples hard to read. (6) I remember somehow you mention that we should add a note in RowMatrix such that the index is meaningless when we are using multiple machines/executors, but this doesn't make sense to me now as there is no index information in RowMatrix and we have fixed the problem in IndexedRowMatrix.
…lSVD, spectralNormEst, and tallSkinnySVD.
What changes were proposed in this pull request?
(Please fill in changes proposed in this fix)
How was this patch tested?
(Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)
(If this patch involves UI changes, please attach a screenshot; otherwise, remove this)